package com.zhongke.cotrun.mapper;


import com.zhongke.cotrun.model.pojo.ServiceType;
import com.zhongke.cotrun.model.pojo.ServiceTypeVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ServiceTypeMapper {
    /**
     * 新增分类
     * @param serviceType
     * @return
     */
    @Insert("INSERT INTO `service_type` (`code`, `type_name`, `rank`, `belong_to`) VALUES (#{code}, #{typeName}, #{rank}, #{belongTo})")
    public boolean insetServiceType(ServiceType serviceType);

    /**
     *查询所有的分类
     * @param rank
     * @return
     */
    public List<ServiceType> selectServiceType(Integer rank);

    /**
     * 根据条件搜索服务分类
     * @param serviceType
     * @return
     */

    public List<ServiceTypeVO> selectServiceTypeBycondition(ServiceType serviceType);

    @Select("SELECT type_name from service_type WHERE `code`=#{code}")
    public ServiceTypeVO selectServiceTypeByCode(Integer code);
}
